<?
session_start();
include("lib/config.php");

// master karyawan
$smst = mssql_query("SELECT * FROM VPrivUser WHERE username='".$HTTP_SESSION_VARS['user_login']."' AND nama_menu='master_karyawan'",$conn);
$rmst = mssql_fetch_array($smst);
// karir ptsi
$skar = mssql_query("SELECT * FROM VPrivUser WHERE username='".$HTTP_SESSION_VARS['user_login']."' AND nama_menu='karir_ptsi'",$conn);
$rkar = mssql_fetch_array($skar);
// sanksi
$ssnk = mssql_query("SELECT * FROM VPrivUser WHERE username='".$HTTP_SESSION_VARS['user_login']."' AND nama_menu='sanksi'",$conn);
$rsnk = mssql_fetch_array($ssnk);
// track record
$strc = mssql_query("SELECT * FROM VPrivUser WHERE username='".$HTTP_SESSION_VARS['user_login']."' AND nama_menu='track_record'",$conn);
$rtrcX = mssql_fetch_array($strc);
// penugasan
$spenug = mssql_query("SELECT * FROM VPrivUser WHERE username='".$HTTP_SESSION_VARS['user_login']."' AND nama_menu='penugasan'",$conn);
$rpenug = mssql_fetch_array($spenug);
// penilaian
$snilai = mssql_query("SELECT * FROM VPrivUser WHERE username='".$HTTP_SESSION_VARS['user_login']."' AND nama_menu='penilaian'",$conn);
$rnilai = mssql_fetch_array($snilai);
// cuti
$scuti = mssql_query("SELECT * FROM VPrivUser WHERE username='".$HTTP_SESSION_VARS['user_login']."' AND nama_menu='cuti'",$conn);
$rcuti = mssql_fetch_array($scuti);
// medical
$smedical = mssql_query("SELECT * FROM VPrivUser WHERE username='".$HTTP_SESSION_VARS['user_login']."' AND nama_menu='medical'",$conn);
$rmedical = mssql_fetch_array($smedical);
// setup medical
$ssetup_med = mssql_query("SELECT * FROM VPrivUser WHERE username='".$HTTP_SESSION_VARS['user_login']."' AND nama_menu='setup_medical'",$conn);
$rsetup_med = mssql_fetch_array($ssetup_med);
// get periode cuti tahunan
//select periode from cutitahunan where nik='71960437' group by periode order by periode desc
$spercut	= mssql_query("select periode from cutitahunan where nik='".$rN[NIK]."' group by periode order by periode desc",$conn);
$rpercut	= mssql_fetch_array($spercut);
$per_cut_tahun = $rpercut[periode];
?>

	  <DIV class="menu" id="Master">
	<?
      if($rmst[baca] == 1){
	?>
		  <A class="menuItem" 
		  <?
          if($rN[NIK] == $_SESSION['user_login']){
			  echo' href="../lib/detailemp.php?show=data_umum&nik='.$rN[NIK].'"';
		  }
		  else{
	          echo' href="../form/frm_cari_pelamar.php"';
          }
		  ?>
          ><SPAN class=menuItemText>&bull; Pelamar</SPAN></A>
    <?
    	}
				
      if($rmst[baca] == 1){
	?>
		  <A class="menuItem" 
		  <?
          if($rN[NIK] == $_SESSION['user_login']){
			  echo' href="../lib/detailemp.php?show=data_umum&nik='.$rN[NIK].'"';
		  }
		  else{
	          echo' href="../form/frm_rekruitmen.php"';
          }
		  ?>
          ><SPAN class=menuItemText>&bull; Rekruitment Pegawai</SPAN></A>
    <?
    	}

	if($rkar[baca] == 1){		
	?>
		  <A class="menuItem" 
          <?
		  if($rN[NIK] == $_SESSION['user_login']){
		  		echo'href="../lib/list_karir.php?show=list_karir&nik='.$rN[NIK].'"';
		  }
		  else{
	        	echo'href="../lib/show.php?show=karirptsi"';
		  }
		  ?>
          ><SPAN class=menuItemText>&bull; Karir di PT. SI</SPAN></A>
    <?
    	}
		
      if($rmst[baca] == 1){
	?>
		  <A class="menuItem" 
		  <?
          if($rN[NIK] == $_SESSION['user_login']){
			  echo' href="../lib/detailemp.php?show=data_umum&nik='.$rN[NIK].'"';
		  }
		  else{
	          echo' href="../lib/show.php?show=employee"';
          }
		  ?>
          ><SPAN class=menuItemText>&bull; Karyawan</SPAN></A>
    <?
    	}
				
      if($rsnk[baca] == 1){	
	  // /lib/list_karir.php?show=list_sanksi&nik=			
	?>
		  <A class="menuItem" 
          <?
			  if($rN[NIK] == $_SESSION['user_login']){
					echo'href="../lib/list_karir.php?show=list_sanksi&nik='.$rN[NIK].'"';
			  }
			  else{
					echo'href="../lib/show.php?show=sanksi"';
			  }
		  ?>
          ><SPAN class=menuItemText>&bull; Sanksi</SPAN></A>
    <?
    }
	
	  if($rtrcX[baca] == "1"){			
	  // http://localhost:81/lib/list_karir.php?show=list_track_record&nik=66970495	
	?>
		  <A class="menuItem" 
          <?
			  if($rN[NIK] == $_SESSION['user_login']){
					echo'href="../lib/list_karir.php?show=list_track_record&nik='.$rN[NIK].'"';
			  }
			  else{
					echo'href="../lib/show.php?show=track_record"';
			  }
		  ?>
          ><SPAN class=menuItemText>&bull; Track Record</SPAN></A>
    <?
    }
	
	  if($rpenug[baca] == 1){				
	?>
		  <A class="menuItem" 
          <?
	  	  if($rN[NIK] == $_SESSION['user_login']){
          	echo'href="../lib/list_karir.php?show=list_tugas&nik='.$rN[NIK].'"';
		  }
		  else{
          	echo'href="../lib/show.php?show=penugasan"';
		  }
          ?>
          ><SPAN class=menuItemText>&bull; Penugasan</SPAN></A>
    <?
    }
	
	  if($rnilai[baca] == 1){				
	?>
		  <A class="menuItem" 
          <?
	  	  if($rN[NIK] == $_SESSION['user_login']){
          	echo'href="../lib/list_karir.php?show=list_nilai&nik='.$rN[NIK].'"';
			}
		  else{
          	echo'href="../lib/show.php?show=penilaian"';
			}
          ?>
          ><SPAN class=menuItemText>&bull; Penilaian</SPAN></A>
    <?
    }
	
	  if($rcuti[baca] == 1){				
	  //lib/listcuti.php?show=cuti_khusus&nik=16700765
	?>
		  <A class="menuItem" 
          <?
		  if($rN[NIK] == $_SESSION['user_login']){
		  //echo'href="/lib/listcuti.php?show=cuti_khusus&nik='.$rN[NIK].'"';
		  //lib/listcuti.php?show=list_cuti_tahunan&periode=2005%20-%202006&nik=71960437
		  echo'href="../lib/listcuti.php?show=list_cuti_tahunan&periode='.$per_cut_tahun.'&nik='.$rN[NIK].'"';
		  }
		  else{
          echo'href="../lib/show.php?show=cuti"';
		  }
		  ?>
		  ><SPAN class=menuItemText>&bull; Cuti Karyawan</SPAN></A>
    <?
    }
	
	  if($rmedical[baca] == 1){				
	  //lib/listmedical.php?show=historical&nik=	
	?>
		  <A class="menuItem" 
          <?
		  if($rN[NIK] == $_SESSION['user_login']){
	      	echo'href="../lib/listmedical.php?show=historical&nik='.$rN[NIK].'"';
          }
		  else{
		  	echo'href="../lib/show.php?show=medical"';
		  }
		  ?>
          ><SPAN class=menuItemText>&bull; Pengobatan</SPAN></A>
	<?
	}
   	  if($rsetup_med[baca] == 1){				
	?>
		  <A class="menuItem" 
          <?
		  if($rN[NIK] == $_SESSION['user_login']){
	        echo'href="../lib/listmedical.php?show=setup_medical&nik='.$rN[NIK].'"';
		  }
		  else{
		  	echo'href="../lib/show.php?show=setup_medical"';
		  }
          ?>
          ><SPAN class=menuItemText>&bull; Plafon Pengobatan</SPAN></A>
    <?
    }
	?>
	  </DIV>
<?
		if($rpar[baca] == 1 || $rpar[edit] == 1 || $rpar[hapus] == 1 || $rpar[tambah] == 1){	  
?>
	  <DIV class="menu" id="PD">
		  <A class="menuItem" href="../lib/show.php?show=par_lokasi"><SPAN class=menuItemText>&bull; Table Lokasi</SPAN></A>
		  <A class="menuItem" href="../lib/show.php?show=tbl_unit_kerja"><SPAN class=menuItemText>&bull; Table Unit Kerja</SPAN></A>
		  <A class="menuItem" href="../lib/show.php?show=par_lp2"><SPAN class=menuItemText>&bull; Table Unsur LP2</SPAN></A>
		  <A class="menuItem" href="../lib/show.php?show=cat_lp2"><SPAN class=menuItemText>&bull; Table Kategori Unsur LP2</SPAN></A>
		  <A class="menuItem" href="../lib/show.php?show=par_fungsional"><SPAN class=menuItemText>&bull; Table Fungsional</SPAN></A>
		  <A class="menuItem" href="../lib/show.php?show=par_jabatan"><SPAN class=menuItemText>&bull; Table Jabatan</SPAN></A>
		  <A class="menuItem" href="../lib/show.php?show=par_jns_cuti"><SPAN class=menuItemText>&bull; Table Jenis Cuti</SPAN></A>
		  <A class="menuItem" href="../lib/show.php?show=par_pendidikan"><SPAN class=menuItemText>&bull; Table Pendidikan</SPAN></A>
		  <A class="menuItem" href="../lib/show.php?show=par_bank"><SPAN class=menuItemText>&bull; Table Bank</SPAN></A>
		  <!--<A class="menuItem" href="#"><SPAN class=menuItemText>&bull; Table RKAP</SPAN></A>-->
		  <A class="menuItem" href="../lib/show.php?show=par_setup"><SPAN class=menuItemText>&bull; Parameter Umum</SPAN></A>
	  </DIV>
<?
		}
		if($radmu[baca] == 1 || $radmu[edit] == 1 || $radmu[hapus] == 1 || $radmu[tambah] == 1){
?>
	  <DIV class="menu" id="AU">
		  <A class="menuItem" href="../form/frm_adm_user.php"><SPAN class=menuItemText>&bull; Table User</SPAN></A>
		  <A class="menuItem" href="../form/frm_adm_group.php"><SPAN class=menuItemText>&bull; Table Group User</SPAN></A>
	  </DIV>
<?
		}
		if($rrep[baca] == 1 || $rrep[edit] == 1 || $rrep[hapus] == 1 || $rrep[tambah] == 1){		
?>
	  <DIV class="menu" id="Report">
		  <A class="menuItem" href="../report/rep_komp_naker.php" target="_blank" ><SPAN class=menuItemText>&bull; Komposisi Tenaga Kerja</SPAN></A>
		  <A class="menuItem" href="../report/rep_stat_pegawai.php" target="_blank" ><SPAN class=menuItemText>&bull; Statistik Kepegawaian</SPAN></A>
		  <A class="menuItem" href="#" onclick="Javascript:window.open('http://<?=$HTTP_SERVER_VARS['HTTP_HOST']?>/form/frm_lap_pegawai.php','','');"><SPAN class=menuItemText>&bull; Laporan Pegawai</SPAN></A>
		  <A class="menuItem" href="#" onclick="Javascript:window.open('http://<?=$HTTP_SERVER_VARS['HTTP_HOST']?>/form/frm_lap_pegawai_pribadi.php','','');" ><SPAN class=menuItemText>&bull; Laporan Pribadi Pegawai</SPAN></A>
		  <A class="menuItem" href="#" onclick="Javascript:window.open('http://<?=$HTTP_SERVER_VARS['HTTP_HOST']?>/form/frm_lap_training.php','','');" ><SPAN class=menuItemText>&bull; Laporan Training</SPAN></A>
		  <A class="menuItem" onclick="Javascript:show_popup2();" target="_blank" ><SPAN class=menuItemText>&bull; Cuti Tahunan - Cuti Besar</SPAN></A>
		  <A class="menuItem" onclick="Javascript:window.open('http://<?=$HTTP_SERVER_VARS['HTTP_HOST']?>/form/frm_lap_monkontrak.php','','');" target="_blank" ><SPAN class=menuItemText>&bull; Monitoring Kontrak Pegawai</SPAN></A>
	  </DIV>
<?
		}
		if($rcvoon[baca] == 1 || $rcvoon[edit] == 1 || $rcvoon[hapus] == 1 || $rcvoon[tambah] == 1){		
?>
	  <DIV class="menu" id="CV">
		  <A class="menuItem" href="../lib/show.php?show=report_emp"><SPAN class=menuItemText>&bull; Cari CV</SPAN></A>
		  <A class="menuItem" href="../lib/show.php?show=log_book_cvonline"><SPAN class=menuItemText>&bull; Book Log Download CV</SPAN></A>
	  </DIV>
<?
		}
?>     
	  <DIV class="menu" id="ReportMedical">
		  <A class="menuItem" href="../form/frm_rep_med.php?show=bank"><SPAN class=menuItemText>&bull; Daftar Transfer Restitusi</SPAN></A>
		  <A class="menuItem" href="../form/frm_rep_med.php?show=restitusi"><SPAN class=menuItemText>&bull; Rekap Data Klaim Biaya Pengobatan</SPAN></A>    
		  <A class="menuItem" href="../form/frm_rep_med.php?show=detail"><SPAN class=menuItemText>&bull; Rekap Detail Klaim Biaya Pengobatan</SPAN></A>    
	  </DIV>
<?
		//}
?>      
	  
	  <DIV class="menu" id="Bantuan">
		  <A class="menuItem" href="../form/frm_ch_pass.php"><SPAN class=menuItemText>&bull; Ubah Password</SPAN></A>
	  </DIV>
<?
//	mssql_free_result();
	mssql_close($conn);
?>
<table width="100%" cellpadding="4" cellspacing="0" style="position:relative; top:75px;">
<tr>
 <td bgcolor="#CCCCCC" style="width:123px;">&nbsp;</td>
 <td bgcolor="#EFEFEF">&nbsp; Aplikasi SDM PT. Surveyor Indonesia, Powered by <a href="http://www.sisfo.net" target="_blank">SISFO</a></td>
</tr>
</table>